const express = require('express');
const router = express.Router();
const orderController = require('../controllers/orderController');
const { isAdmin } = require("../middlewares/adminMiddleware");
const { authenticateToken } = require("../middlewares/authMiddleware");

router.get('/orderinfo', authenticateToken, isAdmin, orderController.getOrders);
router.get('/ordersearch', authenticateToken, orderController.getOrderById);
router.post('/ordercreate', authenticateToken, orderController.createOrder);
router.post('/orderpay', authenticateToken, orderController.payOrder);
router.delete('/orderdelete/:id', authenticateToken, isAdmin, orderController.deleteOrder);
router.post('/setorderdetail', authenticateToken, orderController.createOrderDetail);
router.get('/getorderdetail', authenticateToken, orderController.getOrderDetail);
router.get('/getorder', authenticateToken, orderController.getOrder);
router.put('/updateorderstatus/:orderId', authenticateToken, isAdmin, orderController.updateOrderStatus);
module.exports = router;